define(["model/model"], function($model){
	
	var Navbar = function(data){
		var _this = this;
		
		this.formatChildrens = function(list){
			var childrens = [];
			for(var i=0;list&&i<list.length;i++){
				childrens[i] = new Navbar(list[i]);
			}
			return childrens;
		}
		
		if(data){
			this.id = data.id;
			//权限名称
			this.name = data.name;
			//子节点
			this.childrens = this.formatChildrens(data.childrens);
		}
		
		this.toMap = function(){
			return $model.toMap(_this);
		};
		
		this.toString = function(){
			return $model.toString(_this);
		}
	}
	
	return Navbar;
});